/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Public License. A 
 * copy of the license can be found in the License.html file at the root of this distribution. If 
 * you cannot locate the  Microsoft Public License, please send an email to 
 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
 * PARTICULAR PURPOSE.
 * ***************************************************************************/

#if !defined(AFX_FIELD_H__90BA0B83_3F32_4561_894D_8BA7D4229228__INCLUDED_)
#define AFX_FIELD_H__90BA0B83_3F32_4561_894D_8BA7D4229228__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

namespace contour
{

/*! 
	\defgroup FieldGroup Field classes that emulates functions F(x,y)
	\ingroup ContourLibGroup
*/

/*! \brief A 2d data field base class.

\ingroup FieldGroup
*/
template<class T>
class TField  
{
public:
	struct SLimits
	{
		SLimits( T l=0, T r=1, T b=0, T t=1){ left=l;right=r; top=t; bottom=b;};
		T GetWidth() const {	return right-left;};
		T GetHeight() const {	return top-bottom;};
		T left;
		T right;
		T top;
		T bottom;
	};
	virtual ~TField(){};

	const SLimits& GetLimits()				{	return m_limits;}
	virtual void SetLimits(const SLimits& limits)	{	m_limits = limits;};

	virtual T Eval(T x, T y)=0;
protected:
	SLimits m_limits;
};

};
#endif // !defined(AFX_FIELD_H__90BA0B83_3F32_4561_894D_8BA7D4229228__INCLUDED_)
